package com.hua.springCloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RefreshScope
public class CounsumerController {
    @Autowired
    private RestTemplate restTemplate;
    @Value("${service-url.nacos-user-service}")
    private String url;
    @GetMapping("/consumer/payment/nacos/{id}")
    public String paymentInfo(@PathVariable("id") Long id){
        System.out.println(url);
        return restTemplate.getForObject(url+"/payment/nacos/"+id,String.class);
    }

//    @Value("${config.info}")
//    private String configInfo;
//
//    @GetMapping("/config/info")
//    public String getConfigInfo() {
//        return configInfo+"nacos打印的";
//    }
}
